package com.mioto.ld.communication.mqtt.protocol;

import com.mioto.ld.communication.mqtt.protocol.model.Message;
import com.mioto.ld.communication.mqtt.protocol.model.device.DeviceFaultReportPayload;
import com.mioto.ld.utils.SpringBeanUtil;
import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.Executor;

/**
 * @author mioto-qinxj
 * @date 2024/5/17
 * @desc 设备故障上报处理类
 */
@Slf4j
public class FaultHandleStrategy implements IReceiptHandleStrategy {

    private FaultReportTriggerHandler faultReportTriggerHandler;

    public FaultHandleStrategy(){
        faultReportTriggerHandler = new FaultReportTriggerHandler();
    }

    @Override
    public void protocolHandler(Message message) throws Exception{
        log.info("---------------------设备 - {} 故障上报消息处理开始---------------------",message.getSn());
        faultReportTriggerHandler.handle(message);
        log.info("---------------------设备 - {} 故障上报消息处理结束---------------------",message.getSn());
    }
}
